<?php

class LoginForm extends Zend_Form
{
	
	public $elementDecorator=array(
								'viewHelper',
								'Errors',
								array('Description',array('tag'=>'','escape'=>false)),
								array(array('data'=>'HtmlTag'),
									array('tag'=>'td','valign'=>'top','width'=>'60%')),
								array('Label',array('tag'=>'td')),
								array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
								);
								
	public function init($options = null)
    {
		$this->setName('login');
		$this->setMethod('post');

	    $username =  $this->createElement('text', 'username');
		$username->setLabel('Username:')
			->addFilters(array('StringTrim'))
			->setAttrib('class','input')
            ->setValue('')
    	    ->setRequired(true)
			->setDecorators($this->elementDecorator);

		$password =  $this->createElement('password','password');
		$password->setLabel('Password:')
			->setRequired(true)
			->setAttrib('class','input')
		    ->setValue('')
	        ->setIgnore(false)
			->setDecorators($this->elementDecorator);
			
		$rememberMe =  $this->createElement('checkbox','rememberMe');
		$rememberMe ->setDescription("Remember my login on this computer")
					->setDecorators($this->elementDecorator);	

		$submit =  $this->createElement('submit','save',array('label' => 'Log In'));
	    $submit->setRequired(false)
			->setAttrib('class','button')
	        ->setIgnore(true)
			->setDecorators(array(
								'viewHelper',
								'Errors',
								array(array('data'=>'HtmlTag'),
									array('tag'=>'td','align'=>'center','colspan'=>'2'))
							
					));

	    $this->addElements(array($username,$password, $rememberMe,$submit));
		
		$this->setDecorators(array(
    			'FormElements',
    			array('HtmlTag', array('tag' => 'table','align'=>'center','width'=>'70%','cellspacing'=>'1','cellpadding'=>'0','border'=>'0')),
    			'Form',
				));
	}

}
